package com.Day1009;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Xiangmu {
    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入项目路径：");
        String proPath = in.next();
        proPath = proPath + "\\src";
        File file = new File(proPath);
        file.mkdirs();
        System.out.println("项目创建成功！");
        System.out.println("请输入包名：");
        String packageName = in.next();
        String[] packages = packageName.split("\\.");
        System.out.println(Arrays.toString(packages));
        for (String pack : packages) {
            proPath = proPath + "\\" + pack;
        }//  D:\IDEA\dddd   com.lzy.day01
        File file1 = new File(proPath);
        file1.mkdirs();
        System.out.println("请输入类名：");
        String className = in.next();
        String className1 = className + ".java";
        String classPath = proPath + "//" + className1;
        File classFile = new File(classPath);
        classFile.createNewFile();
        System.out.println("创建成功！");
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("package" + packageName + ";\n");
        stringBuffer.append("public class " + className + "{\n");
        stringBuffer.append("}\n");
        FileOutputStream fileOutputStream = new FileOutputStream(classFile);
        fileOutputStream.write(stringBuffer.toString().getBytes());
        fileOutputStream.close();
        /*
        package com.Day1009;
        public class Text6 {
        }
        *
        * */

    }
}
